const DEV_PRIVATE = {
  VUE_APP_MOCK_STATUS: true,
  VUE_APP_PROXY: "192.168.0.0"
};
const DEV_OPTIONS = [
  {
    ...DEV_PRIVATE,
    NODE_ENV: "development",
    VUE_APP_NAME: "开发",
    match: () => {
      return process.env.NODE_ENV === "development";
    }
  },
  {
    NODE_ENV: "production",
    VUE_APP_NAME: "生产",
    match: (hostname) => {
      return hostname === "www.baidu.com";
    }
  }
];

const getEnvByHostname = () => {
  const { hostname: currentHostname } = window.location;
  return DEV_OPTIONS.find((option) => {
    let { match } = option;
    return match && match.call({}, currentHostname);
  });
};

export default getEnvByHostname();
